using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_salesmenMap : EntityTypeConfiguration<so_salesmen>
    {
        public so_salesmenMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID, t.salesman });

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.salesman)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.region)
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("so_salesmen");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.salesman).HasColumnName("salesman");
            this.Property(t => t.region).HasColumnName("region");
            this.Property(t => t.Customer_Count).HasColumnName("Customer_Count");
        }
    }
}
